#!/bin/bash
waitSend() {
	until [ "${nowIp}" != "${lastIp}" ]
	do	
		nowIp=$(ifconfig | grep '192.168' | awk '{print $2}')
		sleep 2s
	done
	echo "${nowIp}" > /home/pi/shell/ip.txt
	git add . > /dev/null
	git commit -m "$(nowIp) in $(date +"%Y-%m-%d-%r")" > /dev/null
	git push -f origin "master" > /dev/null
	lastIp=${nowIp}
	waitSend
}
lastIp=$(ifconfig | grep '192.168' | awk '{print $2}')
nowIp="$(ifconfig | grep '192.168' | awk '{print $2}')"
waitSend
